package com.wuhanins.insmytestdemo.app;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.google.android.material.bottomnavigation.BottomNavigationView;

import androidx.appcompat.app.AppCompatActivity;

import com.wuhanins.core.promise.Promiser;
import com.wuhanins.http.volley.WebApiVolleyHelper;
import com.wuhanins.http.volley.v3.IOnProxyDoneListener_v3;
import com.wuhanins.insmytestdemo.R;
import com.wuhanins.insmytestdemo.databinding.ActivityMainBinding;
import com.wuhanins.insmytestdemo.domainService.provider.MiPContext;
import com.wuhanins.insmytestdemo.extend.webApiProxy.insSysProxy.getCircleRangeProxy.GetCircleRangeOutput;
import com.wuhanins.insmytestdemo.extend.webApiProxy.insSysProxy.getCircleRangeProxy.GetCircleRangePInput;
import com.wuhanins.insmytestdemo.extend.webApiProxy.insSysProxy.getCircleRangeProxy.GetCircleRangeProxyApi;

public class MainActivity extends AppCompatActivity {

    private ActivityMainBinding binding;

    public static void start(Context context) {
        Intent starter = new Intent(context, MainActivity.class);
        context.startActivity(starter);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        binding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        BottomNavigationView navView = findViewById(R.id.nav_view);
        // Passing each menu ID as a set of Ids because each
        // menu should be considered as top level destinations.
//        AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
//                R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications)
//                .build();
//        NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main);
//        NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
//        NavigationUI.setupWithNavController(binding.navView, navController);

    }

    public Promiser getRoundness(String Lat, String Lon, String Radius) {
        GetCircleRangeProxyApi proxyApi = new GetCircleRangeProxyApi(MiPContext.getInstance());
        GetCircleRangePInput input = new GetCircleRangePInput();
//        input.setLatitude1(30.54238);
        input.setCurrentLatitude(Double.parseDouble(Lat));
//        input.setLongitude1(114.36210);
        input.setCurrentLongitude(Double.parseDouble(Lon));
//        input.setCircleLatitude(30.54261);
//        input.setCircleLongitude(114.36177);
        input.setRadius(Radius);
        return proxyApi.$doRequest(WebApiVolleyHelper.sharedRequestQueue(), input, new IOnProxyDoneListener_v3<GetCircleRangeOutput>() {
            @Override
            public void done() {

            }

            @Override
            public boolean error(int code, String message, int type) {
                return false;
            }

            @Override
            public void success(GetCircleRangeOutput getCircleRangeOutput) {
            }
        });
    }

}